#ifndef LIBACCENT_ALGORITHMS_ALL_OF_HPP
#define LIBACCENT_ALGORITHMS_ALL_OF_HPP

#include "accent/algorithms/fold.hpp"
#include "accent/algorithms/map.hpp"
#include <functional>

namespace accent
{
  // FIXME: Move somewhere else.
  struct id {
    bool operator ()(bool b) const { return b; }
  };

  template <typename SinglePassRange, typename Predicate>
  bool all_of(SinglePassRange range, Predicate predicate)
  {
    return fold_left(true, map(range, predicate),
      std::logical_and<bool>(), id());
  }
}

#endif
